clear
clc
% addpath 临时添加驱动文件所在的路径
% addpath('E:\001_Users\Backup\00MatlabVNAlib\Matlab');
% addpath('F:\SoftData\Matlab\00_my_vna_lib');
% VNA = jwlong_3672C_class;
% VNA = jwlong_E8363B_class;
% VNA = jwlong_N5227B_class;
VNA = jwlong_ZNLE18_class;
[VNA.VNA,VNA.idn]=VNA.ConectVNA('keysight','TCPIP0::192.168.100.2::5025::SOCKET');
pause(1)
VNA.SetFreq(VNA,'START',16*1e9);
VNA.SetFreq(VNA,'STOP',18*1e9);
pause(1)
VNA.SetAutoScale(VNA); 
% filename='20230427/test';
f=[2.66,3.41,4.469]*1e9;
% f=[7.6]*1e9;
% f=4.4695e9;
% f=4.46e9;


for k=1:max(size(f))
VNA.SetMarker(VNA,'MAX',1);
[test.fbw(k),test.f0(k),test.Q0(k),test.loss(k)]=VNA.FindQ(VNA,f(k),200e6);
end
save(filename,'test') 


trace1 = VNA.ReadTrace(VNA);

trace = VNA.ReadTraceF(VNA);